// ex5_7.cpp, 
#include <iostream>
#include <cstring>

const int MaxSize = 20;

struct Car
{
	char brand[MaxSize];
	int year;
};

int main(void)
{
	using std::cout;
	using std::cin;
	using std::endl;

    //Car *ptr = new Car[MaxSize];
	int cnt = 0, Size;
	cout << "How many cars do you wish to catalog? ";
	cin >> Size;
    Car *ptr = new Car[Size];
	char ch;
    while (cnt < Size)
	{
		cout << "Car #" << cnt + 1 << endl;
		cout << "Please enter the make: ";
		cin.get();
		cin.getline(ptr[cnt].brand, MaxSize);	
		cout << "Please enter the year made: ";
		//cin.clear();
		cin >> ptr[cnt].year;
		//cin.get();
		cnt++;
	}

	cout << "\nHere's your collection:" << endl;
	for (int i = 0; i < Size; i++)
	{
		cout << ptr[i].year << ' ' << ptr[i].brand << endl;
	}

	delete ptr;
}

